//
//  HomeTableViewCell.m
//  groupProject
//
//  Created by mac on 15/12/22.
//  Copyright © 2015年 mac. All rights reserved.
//

#import "HomeTableViewCell.h"
#import "HomeTableCellButton.h"
#import "Config.h"
@implementation HomeTableViewCell

- (id) initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier andIndexPath:(NSIndexPath *) indexPath {
    self = [super initWithStyle:UITableViewCellStyleDefault reuseIdentifier:reuseIdentifier];
    if (self) {
        //首行只有两个图片
        if (indexPath.row == 0) {
            self.leftBtn = [[HomeTableCellButton alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH*2/3.0, SCREEN_WIDTH*0.3)];
            self.midBtn = nil;
            self.rightBtn = [[HomeTableCellButton alloc] initWithFrame:CGRectMake(SCREEN_WIDTH*2/3.0, 0, SCREEN_WIDTH/3.0, SCREEN_WIDTH*0.3)];
        } else {
          //其他行  三个图片
            self.leftBtn = [[HomeTableCellButton alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH/3.0, SCREEN_WIDTH*0.3)];
            self.midBtn = [[HomeTableCellButton alloc] initWithFrame:CGRectMake(SCREEN_WIDTH/3.0+2, 0, SCREEN_WIDTH/3.0, SCREEN_WIDTH*0.3)];
            self.rightBtn = [[HomeTableCellButton alloc] initWithFrame:CGRectMake(SCREEN_WIDTH*2/3.0+4, 0, SCREEN_WIDTH/3.0, SCREEN_WIDTH*0.3)];
        }
    }
    
    self.leftBtn.backgroundColor = [UIColor redColor];
    self.midBtn.backgroundColor = [UIColor blueColor];
    self.rightBtn.backgroundColor = [UIColor yellowColor];
    
    [self addSubview:self.leftBtn];
    [self addSubview:self.midBtn];
    [self addSubview:self.rightBtn];
    
    return self;
}


- (void) setData:(NSArray *)array {
    [self.leftBtn setImage:[UIImage imageNamed:array[0]] forState:UIControlStateNormal];
    [self.midBtn setImage:[UIImage imageNamed:array[1]] forState:UIControlStateNormal];
    [self.rightBtn setImage:[UIImage imageNamed:array[2]] forState:UIControlStateNormal];
    
    [self.leftBtn setTitle:array[0] forState:UIControlStateNormal];
    [self.midBtn setTitle:array[1] forState:UIControlStateNormal];
    [self.rightBtn setTitle:array[2] forState:UIControlStateNormal];
    
    //self.leftBtn.titleLabel.a
}





- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
